﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Collections;
using GPCSC.Model;
using NickLee.Common;
using GPCSC.Webs;
using ExtAspNet;

namespace GPCSC.Web.SHFW
{
    public partial class PYEdit : PageBase
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                F_bound();
            }
        }
        protected void F_bound()
        {
            CL_USER_S user = reUser();
            this.username.Text = user.REALNAME.ToString();
            this.dwname.Text = user.POSTName.ToString();
            this.MtxtD_userid.Value = user.CL_USER_SOID.ToString();
        }

        protected void btnRegister_Click(object sender, EventArgs e)
        {
            Hashtable htable = new Hashtable(); 
            htable  =f_getElements(htable);
            htable.Add("username",this.username.Text);
            htable.Add("dwname", this.dwname.Text);
            htable.Add("phoneNum", this.phoneNum.Text);
            htable.Add("Email", this.Email.Text);
            htable.Add("YJcount", this.YJcount.Text);
            databyhtable dh = new databyhtable();
            dh.databyhtables(htable, "add", "CL_PY", "", "");
            PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
        }

        public Hashtable f_getElements(Hashtable o_uiTable)
        {
            //UIFactory Get Values as Hashtable:界面工厂获取值，并保存在哈希表
            base.o_uiTable.Clear();
            base.o_uiTable = UIFactory.UIFactory_Get(this);
            return base.o_uiTable;
        }
        public CL_USER_S reUser()
        {

            byte[] userInfo = (byte[])base.o_baseTable[c_obj.s_userInfo];
            Hashtable userInfoTable = CompressData.UnCompressHashtable(userInfo);
            CL_USER_S users = (GPCSC.Model.CL_USER_S)userInfoTable["SYS_USER"];
            return users;
        }
    }
}